Jan-Philipp Kolb
28 April 2017
Modularer Aufbau
R ist frei verfügbar. Es kann umsonst runtergeladen werden.
Gute Möglichkeiten für die Visualisierung (Link )
R wird immer populärer
edureka - why learn R
Import
https://github.com/Japhilko/RInterfaces
Es lohnt sich immer wieder zu dieser Seite zurückzukehren, weil hier alle relevanten Dokumente verlinkt sind.
Grundsätzlich kann man der Veranstalung am Besten mit dem kompletten File folgen. Wenn Teile heruntergeladen werden sollen, bietet es sich an, das entsprechende pdf herunterzuladen.
Zum Ausdrucken eignen sich die pdf-Dateien besser.
Diese können mit dem Raw Button heruntergeladen werden.
Raw Button zum Download
Begleitend zu den Folien wird meistens auch ein R-File angeboten.
Hier können Sie entweder das gesamte R-File herunterladen und in R ausführen oder einzelne Befehle per Copy/Paste übernehmen.
Vereinzelt sind auch Datensätze vorhanden.
.csv Dateien können direkt von R eingelesen werden (wie das geht werde ich noch zeigen).
Wenn die .csv Dateien heruntergeladen werden sollen auch den Raw Button verwenden.
Alle anderen Dateien (bspw. .RData) auch mittels Raw Button herunterladen.
R unterstützt von Haus aus schon einige wichtige Formate:
read.csv()read.fwf()read.delim()Import Button
https://data.montgomerycountymd.gov/api/views/6rqk-pdub/rows.csv?accessType=DOWNLOAD
So findet man heraus, in welchem Verzeichnis man sich gerade befindet
getwd()So kann man das Arbeitsverzeichnis ändern:
Man erzeugt ein Objekt in dem man den Pfad abspeichert:
main.path <- "C:/" # Beispiel für Windows
main.path <- "/users/Name/" # Beispiel für Mac
main.path <- "/home/user/" # Beispiel für LinuxUnd ändert dann den Pfad mit setwd()
setwd(main.path)Bei Windows ist es wichtig Slashs anstelle von Backslashs zu verwenden.
library(foreign) ist für den Import von fremden Datenformaten hilfreichforeign einlesen.read.csv() genutzt werden um die Daten einzulesen.read.csv2() wegen der Komma-Separierung braucht.library(foreign)
?read.csv
?read.csv2Zunächst muss das Arbeitsverzeichnis gesetzt werden, in dem sich die Daten befinden:
Dat <- read.csv("schuldaten_export.csv")Wenn es sich um Deutsche Daten handelt:
Dat <- read.csv2("schuldaten_export.csv").csv-Daten aus dem Web importierenurl <- "https://raw.githubusercontent.com/Japhilko/
GeoData/master/2015/data/whcSites.csv"
whcSites <- read.csv(url) head(whcSites)## X unique_number id_no rev_bis
## 1 1 230 208 Rev
## 2 2 234 211 Rev
## 3 3 1590 569 Bis
## 4 4 1563 570 ter
## 5 5 111 102 <NA>
## 6 6 209 188 <NA>
## name_en
## 1 Cultural Landscape and Archaeological Remains of the Bamiyan Valley
## 2 Minaret and Archaeological Remains of Jam
## 3 Historic Centres of Berat and Gjirokastra
## 4 Butrint
## 5 Al Qal'a of Beni Hammad
## 6 M'Zab Valley
## name_fr
## 1 Paysage culturel et vestiges archéologiques de la vallée de Bamiyan
## 2 Minaret et vestiges archéologiques de Djam
## 3 Centres historiques de Berat et de Gjirokastra
## 4 Butrint
## 5 La Kalâa des Béni Hammad
## 6 Vallée du M'Zab
## short_description_en
## 1 <p>The cultural landscape and archaeological remains of the Bamiyan Valley represent the artistic and religious developments which from the 1st to the 13th centuries characterized ancient Bakhtria, integrating various cultural influences into the Gandhara school of Buddhist art. The area contains numerous Buddhist monastic ensembles and sanctuaries, as well as fortified edifices from the Islamic period. The site is also testimony to the tragic destruction by the Taliban of the two standing Buddha statues, which shook the world in March 2001.</p>
## 2 <p>The 65m-tall Minaret of Jam is a graceful, soaring structure, dating back to the 12th century. Covered in elaborate brickwork with a blue tile inscription at the top, it is noteworthy for the quality of its architecture and decoration, which represent the culmination of an architectural and artistic tradition in this region. Its impact is heightened by its dramatic setting, a deep river valley between towering mountains in the heart of the Ghur province.</p>
## 3 <p>Berat and Gjirokastra are inscribed as rare examples of an architectural character typical of the Ottoman period. Located in central Albania, Berat bears witness to the coexistence of various religious and cultural communities down the centuries. It features a castle, locally known as the Kala, most of which was built in the 13th century, although its origins date back to the 4th century BC. The citadel area numbers many Byzantine churches, mainly from the 13th century, as well as several mosques built under the Ottoman era which began in 1417. Gjirokastra, in the Drinos river valley in southern Albania, features a series of outstanding two-story houses which were developed in the 17th century. The town also retains a bazaar, an 18th-century mosque and two churches of the same period.</p>
## 4 <p>Inhabited since prehistoric times, Butrint has been the site of a Greek colony, a Roman city and a bishopric. Following a period of prosperity under Byzantine administration, then a brief occupation by the Venetians, the city was abandoned in the late Middle Ages after marshes formed in the area. The present archaeological site is a repository of ruins representing each period in the city’s development.</p>
## 5 <p>In a mountainous site of extraordinary beauty, the ruins of the first capital of the Hammadid emirs, founded in 1007 and demolished in 1152, provide an authentic picture of a fortified Muslim city. The mosque, whose prayer room has 13 aisles with eight bays, is one of the largest in Algeria.</p>
## 6 <p>A traditional human habitat, created in the 10th century by the Ibadites around their five <em>ksour</em> (fortified cities), has been preserved intact in the M’Zab valley. Simple, functional and perfectly adapted to the environment, the architecture of M’Zab was designed for community living, while respecting the structure of the family. It is a source of inspiration for today’s urban planners.</p>
## short_description_fr
## 1 <p>Le paysage culturel et les vestiges archéologiques de la vallée de Bamiyan illustrent les développements artistiques et religieux qui, du Ier au XIIIe siècle, ont caractérisé l’ancienne Bactriane, intégrant diverses influences culturelles pour former l’école d’art bouddhique du Gandhara. Le site contient plusieurs ensembles monastiques et sanctuaires bouddhistes, ainsi que des édifices fortifiés de la période islamique. Il témoigne également de la tragique destruction des deux bouddhas debout par les taliban, qui ébranla le monde en mars 2001.</p>
## 2 <p>Haut de 65m, le minaret de Djam est une construction gracieuse et élancée datant du XIIe siècle. Recouvert dâune décoration complexe en briques et portant une inscription de tuiles bleues au sommet, il est remarquable par la qualité de son architecture et de ses motifs décoratifs, qui représentent lâapogée dâune tradition artistique propre à cette région. Son impact est renforcé par un environnement spectaculaire : une vallée profonde qui sâouvre entre dâimposantes montagnes au cÅur de la province du Ghor.</p>
## 3 <p>Berat et Gjirokastra sont inscrites en tant que rares exemples d'un style architectural typique de la période ottomane. Située dans le centre de l'Albanie, Berat porte le témoignage de la coexistence de différentes communautés religieuses et culturelles au fil des siècles. Elle comprend un château, localement appelé le Kala, dont la majeure partie fut construite au XIIIe siècle, bien que ses origines remontent au IVe siècle avant JC. Le quartier de la citadelle compte de nombreuses églises byzantines, dont plusieurs du XIIIème siècle, ainsi que plusieurs mosquées construites sous l'ère ottomane qui débuta en 1417. Gjirokastra, dans la vallée de la rivière Drinos au sud de l'Albanie, comprend une série de remarquables maisons à deux étages, qui se développèrent au XVIIe siècle. La ville comprend également un bazar, une mosquée du XVIIIe siècle ainsi que deux églises de la même époque.</p>
## 4 <p>Habité depuis les temps préhistoriques, le site de Butrint fut successivement le siège d’une colonie grecque, d’une ville romaine, puis d’un évêché. Après une époque de prospérité sous l’administration de Byzance, puis une brève occupation vénitienne, la ville fut abandonnée par sa population à la fin du Moyen Âge à cause de la présence de marécages voisins. Le site archéologique actuel est un conservatoire des ruines représentatives de chaque période du développement de la ville.</p>
## 5 <p>Dans un site montagneux d’une saisissante beauté, les ruines de la première capitale des émirs hammadides, fondée en 1007 et démantelée en 1152, nous restituent l’image authentique d’une ville musulmane fortifiée. Sa mosquée, avec sa salle de prière de 13 nefs à 8 travées, est l’une des plus grandes d’Algérie.</p>
## 6 <p>Le paysage de la vallée du M’Zab, créé au Xe siècle par les Ibadites autour de leurs cinq <em>ksour</em>, ou villages fortifiés, semble être resté intact. Simple, fonctionnelle et parfaitement adaptée à l’environnement, l’architecture du M’Zab a été conçue pour la vie en communauté, tout en respectant les structures familiales. C’est une source d’inspiration pour les urbanistes d’aujourd’hui.</p>
## justification_en
## 1 <p><em>Criterion (i):</em> The Buddha statues and the cave art in Bamiyan Valley are an outstanding representation of the Gandharan school in Buddhist art in the Central Asian region.</p>\n\n\n<p><em>Criterion (ii)</em> : The artistic and architectural remains of Bamiyan Valley, and an important Buddhist centre on the Silk Road, are an exceptional testimony to the interchange of Indian, Hellenistic, Roman, Sasanian influences as the basis for the development of a particular artistic expression in the Gandharan school. To this can be added the Islamic influence in a later period.</p>\n\n\n<p><em>Criterion (iii):</em> The Bamiyan Valley bears an exceptional testimony to a cultural tradition in the Central Asian region, which has disappeared.</p>\n\n\n<p><em>Criterion (iv):</em> The Bamiyan Valley is an outstanding example of a cultural landscape which illustrates a significant period in Buddhism.</p>\n\n\n<p><em>Criterion (vi):</em> The Bamiyan Valley is the most monumental expression of the western Buddhism. It was an important centre of pilgrimage over many centuries. Due to their symbolic values, the monuments have suffered at different times of their existence, including the deliberate destruction in 2001, which shook the whole world.</p>
## 2 <p><em>Criterion (ii):</em> The innovative architecture and decoration of the Minaret of Jam played a significant role in the development of the arts and architecture of the Indian sub-continent and beyond.</p>\n\n\n<p><em>Criterion (iii): </em>The Minaret of Jam and its associated archaeological remains constitute exceptional testimony to the power and quality of the Ghurid civilization that dominated its region in the 12th and 13th centuries.</p>\n\n\n<p><em>Criterion (iv): </em>The Minaret of Jam is an outstanding example of Islamic architecture and ornamentation in this region and played a significant role in their further dissemination.</p>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
## justification_fr
## 1 <p><em>Critère (i):</em> Les statues de Bouddha et l’art rupestre de la vallée de Bamyan sont une représentation exceptionnelle de l’école du Gandhara dans l’art bouddhique de la région d’Asie centrale.</p>\n\n\n<p><em>Critère (ii):</em> Les vestiges artistiques et architecturaux de la vallée de Bamyan, important centre bouddhiste sur la Route de la Soie, sont un témoignage exceptionnel de l’échange des influences indiennes, hellénistiques, romaines et sassanides qui ont servi de fondations à une expression artistique particulière de l’école du Gandhara. À cela s’ajoute une influence islamique ultérieure.</p>\n\n\n<p><em>Critère (iii):</em> La vallée de Bamyan est un témoignage exceptionnel d’une tradition culturelle d’Asie centrale aujourd’hui disparue.</p>\n\n\n<p><em>Critère (iv):</em> La vallée de Bamyan est un exemple exceptionnel de paysage culturel illustrant une période significative du bouddhisme.</p>\n\n\n<p><em>Critère (vi):</em> La vallée de Bamyan est l’expression monumentale la plus importante du Bouddhisme occidental. Ce fut un centre de pèlerinage essentiel sur plusieurs siècles. Les monuments, en raison de leurs valeurs symboliques, ont souffert à différentes périodes de leur histoire, notamment lors de la destruction délibérée de 2001, qui secoua le monde entier.</p>
## 2 <p><em>Critère (ii)</em> : L'architecture et la décoration innovatrices du Minaret de Djam ont joué un rôle significatif dans le développement des arts et de l'architecture du sous-continent indien et au-delà .</p>\n\n\n<p><em>Critère (iii)</em> : Le minaret de Djam et ses vestiges archéologiques associés constituent un témoignage exceptionnel de la puissance et de la qualité de la civilisation ghoride qui domina cette région aux XIIe et XIIIe siècles.</p>\n\n\n<p><em>Critère (iv)</em> : Le minaret de Djam est un exemple exceptionnel de lâarchitecture et de lâornementation islamiques dans la région et joua un rôle dans leur diffusion.</p>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
## date_inscribed secondary_dates danger_list longitude latitude
## 1 2003 <NA> Y 2003 67.82525 34.84694
## 2 2002 <NA> Y 2002 64.51606 34.39656
## 3 2005 2008 <NA> 20.13333 40.06944
## 4 1992 1999 <NA> 20.02611 39.75111
## 5 1980 <NA> <NA> 4.78684 35.81844
## 6 1982 <NA> <NA> 3.68333 32.48333
## area_hectares C1 C2 C3 C4 C5 C6 N7 N8 N9 N10 criteria_txt
## 1 158.9265 1 1 1 1 0 1 0 0 0 0 (i)(ii)(iii)(iv)(vi)
## 2 70.0000 0 1 1 1 0 0 0 0 0 0 (ii)(iii)(iv)
## 3 58.9000 0 0 1 1 0 0 0 0 0 0 (iii)(iv)
## 4 NA 0 0 1 0 0 0 0 0 0 0 (iii)
## 5 150.0000 0 0 1 0 0 0 0 0 0 0 (iii)
## 6 665.0300 0 1 1 0 1 0 0 0 0 0 (ii)(iii)(v)
## category category_short states_name_en states_name_fr
## 1 Cultural C Afghanistan Afghanistan
## 2 Cultural C Afghanistan Afghanistan
## 3 Cultural C Albania Albanie
## 4 Cultural C Albania Albanie
## 5 Cultural C Algeria Algérie
## 6 Cultural C Algeria Algérie
## name_en.1 name_fr.1 iso_code udnp_code
## 1 Asia and the Pacific Asie et pacifique af afg
## 2 Asia and the Pacific Asie et pacifique af afg
## 3 Europe and North America Europe et Amérique du nord al alb
## 4 Europe and North America Europe et Amérique du nord al alb
## 5 Arab States Ãtats arabes dz dza
## 6 Arab States Ãtats arabes dz dza
## transboundary
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
Dateien können auch direkt aus dem Internet geladen werden:
link<- "http://www.statistik.at/web_de/static/
mz_2013_sds_-_datensatz_080469.sav"
?read.spss
Dat <- read.spss(link,to.data.frame=T)xlsxlibrary("xlsx")
dat <- read.xlsx("cult_emp_sex.xls",1)fileXls <- "data/newFile.xlsx"
unlink(fileXls, recursive = FALSE, force = FALSE)
exc <- loadWorkbook(fileXls, create = TRUE)
createSheet(exc,'Input')
saveWorkbook(exc)input <- data.frame('inputType'=c('Day','Month'),'inputValue'=c(2,5))
writeWorksheet(exc, input, sheet = "input", startRow = 1, startCol = 2)
saveWorkbook(exc)myFunction <- function(){
aa <- rnorm(200)
bb <- rnorm(200)
res <- lm(aa~bb)$res
return(res)
}Markdown ist eine sehr einfache Syntax, die es Benutzern erlaubt, aus einfachen Textdateien gut gelayoutete Dokumente zu erstellen.
**fettes Beispiel**
*kursives Beispiel*
~~durchgestrichen~~
- Aufzählungspunkt
fettes Beispiel
kursives Beispiel
durchgestrichen
### Überschrift Ebene 3
#### Überschrift Ebene 4
[Meine Github Seite](https://github.com/Japhilko)


n=100Ein inline Codeblock: 100
| Argument | Beschreibung |
|---|---|
| eval | Soll Rcode evaluiert werden? |
| warning | Sollen Warnings angezeigt werden? |
| cache | Soll der Output gespeichert werden? |
knitrinstall.packages("knitr")library("knitr")kable um Tabellen zu erzeugenkable erzeugena <- runif(10)
b <- rnorm(10)
ab <- cbind(a,b)
kable(ab)| a | b |
|---|---|
| 0.6061532 | 0.6976463 |
| 0.4971367 | 1.3133231 |
| 0.2344954 | 0.8289510 |
| 0.8029970 | -1.4756648 |
| 0.7863071 | 0.1589139 |
| 0.6588728 | -0.8002320 |
| 0.6765894 | 0.8921335 |
| 0.7041389 | -0.8169958 |
| 0.6368197 | -0.8411820 |
| 0.6784360 | 0.9775720 |
cache=T angegeben ist, wird das Ergebnis des Chunks abgespeichert---
title: "Intro - Erste Schritte"
author: "Jan-Philipp Kolb"
date: "10 April 2017"
output:
beamer_presentation:
colortheme: beaver
theme: CambridgeUS
---
output:
beamer_presentation:
toc: yes
\Sexpr{}
citation() bekommt man sehr schnell die Referenzcitation("RMySQL")##
## To cite package 'RMySQL' in publications use:
##
## Jeroen Ooms, David James, Saikat DebRoy, Hadley Wickham and
## Jeffrey Horner (2017). RMySQL: Database Interface and 'MySQL'
## Driver for R. R package version 0.10.11.
## https://CRAN.R-project.org/package=RMySQL
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {RMySQL: Database Interface and 'MySQL' Driver for R},
## author = {Jeroen Ooms and David James and Saikat DebRoy and Hadley Wickham and Jeffrey Horner},
## year = {2017},
## note = {R package version 0.10.11},
## url = {https://CRAN.R-project.org/package=RMySQL},
## }
---
title: "R Schnittstellen"
author: "Jan-Philipp Kolb"
date: "21 April 2017"
output:
pdf_document: default
bibliography: Rschnittstellen.bib
---
## [1] "Fri Apr 28 15:16:29 2017"
$$
\begin{equation}\label{eq2}
t_{i}=\sum\limits_{k=1}^{M_{i}}{y_{ik}}=M_{i}\bar{Y}_{i}.
\end{equation}
$$
Folie mit zwei Spalten
====================================
Erste Spalte
***
Zweite Spalte
transition: rotate
Ein neues Kapitel einfügen
====================================
type: section
Anderer Folientyp
====================================
type: prompt
Noch ein anderer Folientyp
====================================
type: alert
Meine Präsentation
========================================
author: Jan-Philipp Kolb
font-family: 'Impact'
Meine Präsentation
========================================
author: Jan-Philipp Kolb
font-import: http://fonts.googleapis.com/css?family=Risque
font-family: 'Risque'
Normale Schriftgröße
<small>This sentence will appear smaller.</small>

---
title: "ioslides Beispiel"
author: "Jan-Philipp Kolb"
date: "20 April 2017"
output:
ioslides_presentation:
logo: figure/Rlogo.png
---
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Um den Präsentationstyp zu ändern kann man das CSS verändern
import sys
print(sys.version)## 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)]
jupyter notebook